package com.xhsj.user.sms.purchase.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xhsj.user.sms.purchase.entity.TbPurchaseApply;
import com.xhsj.user.sms.purchase.entity.TbPurchaseTask;
import com.xhsj.user.sms.purchase.query.FindRunTaskListQuery;
import com.xhsj.user.sms.purchase.vo.DepartmentTaskDetailsListQueryVo;
import com.xhsj.user.sms.purchase.vo.FindHiTaskListVo;
import com.xhsj.user.sms.purchase.vo.FindRunTaskListQueryVo;
import com.xhsj.user.sms.purchase.vo.PurchaseApplyQueryVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 采购申请表 Mapper 接口
 * </p>
 *
 * @author suxiaolin
 * @since 2020-04-13
 */
@Mapper
public interface TbPurchaseApplyMapper extends BaseMapper<TbPurchaseApply> {

    IPage<FindRunTaskListQueryVo> findRunTaskList(Page<TbPurchaseApply> page, @Param("roleList") List<String> roleList, @Param("departList") List<String> departList, @Param("entity") FindRunTaskListQuery entity);

    IPage<FindHiTaskListVo> findHiTaskList(Page<TbPurchaseApply> page, @Param("entity") FindRunTaskListQuery entity);

    //申购详情
    List<DepartmentTaskDetailsListQueryVo> subscriptionDetailsList(@Param("purchaseApplyId") String purchaseApplyId);

    //获取申购详情列表
    PurchaseApplyQueryVo getPurchaseApplyList(@Param("purchaseApplyId") String purchaseApplyId);

    //订单子任务审批
    IPage<FindRunTaskListQueryVo> findRunOrderSubtaskTaskList(Page<TbPurchaseApply> page,
                                                              @Param("roleList") List<String> roleList,
                                                              @Param("departList") List<String> departList,
                                                              @Param("entity") FindRunTaskListQuery entity);

    //获取最新的采购申请编号
    String getApplyNewNum(@Param("kinds") String kinds);

    IPage<Map<String,Object>> findPurchaseApply(IPage<TbPurchaseTask> page, @Param("userId") String userId);

    Map<String, String> getTransferByDataId(@Param("id") String id);

    List<Integer> getNodeNum(@Param("dataId") String dataId);

    IPage<FindHiTaskListVo> findOrderHiTaskList(Page<TbPurchaseApply> page, @Param("entity") FindRunTaskListQuery entity);
}
